package com.project.handle.homeHandle;

import com.project.handle.HomeRichHandle;
import com.project.pojo.RiskController;
import com.project.utils.ErrorMessage;
import com.project.utils.GetRiskCode;
import com.project.vo.HomeMessage;
import org.apache.commons.lang.StringUtils;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Order(3)
public class HomeTubeHandleImpl extends HomeRichHandle {
    @Override
    public void homeRiskAssess(HomeMessage homeMessage, List<RiskController> list, List<ErrorMessage> errorMessageList) {
        if (StringUtils.isEmpty(homeMessage.getTubeStatus())) {
            ErrorMessage errorMessage = new ErrorMessage();
            errorMessage.setError("管道信息为空!");
            errorMessageList.add(errorMessage);
            return;
        }
        int code = GetRiskCode.getCode(homeMessage.getTubeStatus(), list);
        int preCode = homeMessage.getRiskCode();
        homeMessage.setRiskCode(preCode + code);
    }
}

